﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using TYAJZWeb.Data;
using TYAJZWeb.Utils;

namespace TYAJZWeb.Models
{
    public class LogListModel
    {
        public String Name { get; set; }
        public String Type { get; set; }
        public String Value { get; set; }

        public String TypeValue
        {
            get
            {
                LogTypes types = LogTypes.None;
                Enum.TryParse<LogTypes>(this.Type, out types);
                switch (types)
                {
                    case LogTypes.Company: return "备案机构";
                    case LogTypes.Equipment: return "备案设备";
                    case LogTypes.Project: return "项目";
                    default:
                        return string.Empty;
                }
            }
        }
        public static explicit operator LogListModel(Log model)
        {
            return new LogListModel()
            {
                Name = model.User.RealName,
                Type = model.Type,
                Value = model.Value
            };
        }
    }
}